#!/bin/bash

set -exu

CUDA_VISIBLE_DEVICES=4 NOUGAT_CHECKPOINT=/data/home/work/model/torch_hub/nougat-0.1.0-base NOUGAT_BATCHSIZE=8 \
    python3 nougat_api &> _log/nougat.log &

LOGDIR='' PYTHONPATH=fastchat:$PYTHONPATH \
    python3 -m fastchat.serve.controller --host 127.0.0.1 --port 8760 &> _log/controller.log &

sleep 1

LOGDIR='' PYTHONPATH=fastchat:$PYTHONPATH CUDA_VISIBLE_DEVICES=5 \
    python3 -m fastchat.serve.model_worker --controller-address http://127.0.0.1:8760 --model-path /data/home/work/model/ECNU-SEA/SEA-E --host 127.0.0.1 --port 8761 --worker-address http://127.0.0.1:8761
    #python3 -m fastchat.serve.model_worker --controller-address http://127.0.0.1:8760 --model-path /data/home/work/model/ECNU-SEA/SEA-E --host 127.0.0.1 --port 8761 --worker-address http://127.0.0.1:8761 &> _log/model_worker.log &

LOGDIR='' PYTHONPATH=fastchat:$PYTHONPATH \
    python3 -m fastchat.serve.openai_api_server --controller-address http://127.0.0.1:8760 --host 127.0.0.1 --port 8765 &> _log/openai_api.log &

wait
